<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('FTP信息（FTP维护系统）列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>配置名称：</label>
                                <input type="text" name="configName" id="configName"/>
                            </li>
                            <li>
                                <label>单位：</label>
                                <input type="text" name="configName" id="deptName"/>
                            </li>
                            <li class="select-time">
                                <label>时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.table.exportExcelTwo()" shiro:hasPermission="system:config:export">
                                    <i class="fa fa-download"></i> 导出详情
                                </a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:config:export">
                    <i class="fa fa-download"></i> 导出统计
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
          <!--  <div id style="width: 100%;height: 33%;background-color: #00a65a;float: inline-end;"></div>-->
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <script type="text/javascript" src="https://registry.npmmirror.com/echarts/5.4.3/files/dist/echarts.min.js"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:config:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:config:remove')}]];
        var prefix = ctx + "system/ftpconfig";
        $('#startTime').val(getPreviousDay())
        $('#endTime').val(getNextDay())
        $(function() {
            var options = {
                url: prefix + "/tstj",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                exportUrlTwo: prefix + "/exportExcelTwo",
                modalName: "FTP信息（FTP维护系统）",
                //pageSize:8,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'configName',
                    title: '配置名称'
                },
                {
                    field: 'cg',
                    title: '推送成功'
                },
                {
                    field: 'sb',
                    title: '推送失败'
                }]
            };
            $.table.init(options);
        });
        //前一天时间
        function getPreviousDay() {
            const today = new Date(); // 获取当前时间
            const previousDay = new Date(today); // 复制当前时间对象
            previousDay.setDate(today.getDate()); // 将日期减少一天
            return formatDate(previousDay);
        }
        //后一天时间
        function getNextDay() {
            const today = new Date(); // 获取当前时间
            const nextDay = new Date(today); // 复制当前时间对象
            nextDay.setDate(today.getDate() + 1); // 将日期增加一天
            return formatDate(nextDay);
        }
        //时间格式转换
        function formatDate(date) {
            const year = date.getFullYear();
            const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需要加1，并且补零
            const day = String(date.getDate()).padStart(2, '0'); // 日期可能是一位数，需要补零
            return `${year}-${month}-${day}`;
        }
    </script>
</body>
</html>